#{extends 'frameHome.html' /} #{set title:'Idea' /}
<div id=main>


<hr /> 

#{if idea.topic}
<p><b>Idea Topic Title:<a href="@{Topics.showTopic(idea.topic.id)}" > ${idea.topic.title}</a> </b></p>
<p><b> in Entity:<a href="@{Entity.viewEntity(idea.topic.entity.id)}" > ${idea.topic.entity.entityName}
</a></b></p> 
<p><b>
in Organization: <a href="@{Organizations.showOrganization(idea.topic.entity.organization.id)}" >${idea.topic.entity.organization.name} 
</a></b></p> 
#{/if}

#{if idea.entity}
<p><b>Idea Entity Name: <a href="@{Entity.viewEntity(idea.entity.id)}" >${idea.entity.entityName}</a>
<p><b>in Organization: <a href="@{Organizations.showOrganization(idea.entity.organization.id)}" >${idea.entity.organization.name}</a></b></p>
#{/if}

#{if idea.organization}
<p><b>Idea Organization Name:<a href="@{Organizations.showOrganization(idea.organization.id)}" >${idea.organization.name}</a>
 </b></p>
#{/if}



<p> Title: ${idea.title}<p>
<p> Body: ${idea.body}<p>
<p> Posted By: ${idea.author.name}<p>
<p> Priority: ${idea.priority}<p>
<p> Date of Creation: ${idea.postedAt}<p>
<p> Idea execution: ${idea.execution}<p>


#{if user!=idea.author}
	#{if isSpammed == false}
	<p class="field">
		<a href="@{PostingIdea.showIdeaSpam(idea.id)}" class="pill button"
			onclick="alert ('The Idea has been marked as spam');">Mark as spam </a>
	</p>
	#{/if} #{else}
	<p class="field">
		<a href="" class="pill button"
			onclick="alert ('This idea is already flagged !');">Mark as spam </a>
	</p>
	#{/else} #{/if} 
<br>
The rating of this idea: ${idea.rate}/5.0
<br>

<form action="@{Rating.rateIdea(idea.id)}" method="Post">
<input type="radio" name="rate" value="1">
<input type="radio" name="rate" value="2">
<input type="radio" name="rate" value="3">
<input type="radio" name="rate" value="4">
<input type="radio" name="rate" value="5">
<br>
<input type=submit value="Rate Idea">
<a name="fb_share" type="button"
		href="http://www.facebook.com/sharer.php">share</a>
	<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
		type="text/javascript"></script>
	
</form>
<form action="@{ShareIdea.shareIdea(idea.id)}"method="Post">
Enter the name of the community:<input type = "text" name="communityNameBox" id="communityNameBox">
<input type=submit value="Share Idea">
</form>

<br>
<form action="@{SearchForIdeas.sendDuplicate()}" method="Get">
This is the id of the idea you are on please don't change it:<input type = "long"  value=${idea.id} name="ideaId" /><br/>
Enter the name of the idea you believe is duplicate to this idea and then press Send Duplicate:<input type = "text" name="duplicate"/>
<br><input type=submit value="Send Duplicate"/></br>
</form>	
</br>

<p><b> Idea is tagged in :
#{if idea.tags}
#{list items:idea.tags, as:'tag'}
<ul>
<li><a href="@{Tags.ShowTag(tag.id)}">${tag.name} </a></li>
</ul>
#{/list}
#{/if}
#{else}
No Tags !!
#{/else}
</b></p>

<form action= "@{Comments.postOnIdea(idea.id)}"   method="Post">
 
  
         <label for="body0"> Post your comment:</label> 
	    <input type="text"name="body" required="true"></input>
	   
	    <input type="submit" value=" Comment">
	     #{ifErrors}
        <p class="error">
            Please enter Your Comment
          </p>
    #{/ifErrors} 
	  </form>
	  <div class="Comments">
        <h3>
            ${idea.comments.size() ?: 'no'} 
            comment${idea.comments.size().pluralize()}
        </h3>
        #{list items:idea.comments, as:'comment'}
           
            <div class="Comment">
             <div class="comment-body">
                    <div class="about"></div>
                <li>${comment.body} </li> 
                <form action="@{Comments.deleteCommentOnIdea(comment.id,idea.id)}"  method="Post"> 
               <input type="submit" value="Delete"></form>
                </div>
                <div class="comment-metadata">
                    <span class="comment-commentator">by ${comment.commentator.name},</span>
                    <span class="comment-date">
                        ${comment.posttime.format('dd MMM yy')}
                    </span>
                </div>
                
</div>
</div>

 #{/list}
</div>



